let f_lonlat2px = function lonlat2px(mapWidth, mapHeight, centerX, centerY, zoom, targetX, targetY) {
    function scale(a) {
      return 256 * Math.pow(2, a)
    }
    /**
     w84转为墨卡托坐标(经纬度转墨卡托)
    WGS84是地理坐标的一种,地理坐标本身有很多种,web墨卡托是投影坐标
  
    lon :    w84经度
    lat :    w84纬度
    */
    function lonLat2Mercator(lon, lat) {
      var x = lon * 20037508.34 / 180;
      var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
      y = y * 20037508.34 / 180;
      return [x, y];
    }
  
    /**
     将墨卡托坐标转为w84(墨卡托转经纬度)
    x :    墨卡托经度
    y :    墨卡托纬度
    */
    function Mercator2lonLat(x, y) {
      var lon = (x / 20037508.34) * 180;
      var lat = (y / 20037508.34) * 180;
      lat = 180 / Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180)) - Math.PI / 2);
      return [lon, lat];
    }
  
    //输出结果 像素坐标
    var result = {
      x: 0,
      y: 0
    }
  
    //中心点转墨卡托投影坐标
    var centerMec = lonLat2Mercator(centerX, centerY);
  
  
  
    var worldWidth = scale(zoom);
    var resoultion66 = (20037508.34 * 2 / worldWidth);
  
    var targetMec = lonLat2Mercator(targetX, targetY);
    var dx = (targetMec[0] - centerMec[0]) / resoultion66;
    var dy = (targetMec[1] - centerMec[1]) / resoultion66;
    // //相差像素数，进行展示
    // result.x = Math.round(dx);
    // result.y = Math.round(dy);
  
    console.log("比例尺：" + zoom + "," + scale(zoom));
    // console.log("resoultion："+resoultion);
    console.log("resoultion：" + resoultion66);
  
  
  
    result.x = Math.round(dx) + mapWidth / 2;
    result.y = mapHeight / 2 - Math.round(dy);
    return result;
  }
  
  let f_px2lonlat = function px2lonlat(mapWidth, mapHeight, centerX, centerY, zoom, targetX, targetY) {
    function scale(a) {
      return 256 * Math.pow(2, a)
    }
    function lonLat2Mercator(lon, lat) {
      var x = lon * 20037508.34 / 180;
      var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
      y = y * 20037508.34 / 180;
      return [x, y];
    }
  
  
    function Mercator2lonLat(x, y) {
      var lon = (x / 20037508.34) * 180;
      var lat = (y / 20037508.34) * 180;
      lat = 180 / Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180)) - Math.PI / 2);
      return [lon, lat];
    }
    //输出结果 像素坐标
    var result = {
      x: 0,
      y: 0
    }
  
  
    var worldWidth = scale(zoom);
    var resoultion66 = (20037508.34 * 2 / worldWidth);
  
    var centerMec = lonLat2Mercator(centerX, centerY);
  
    //中心点像素坐标
    var centerPX = mapWidth / 2;
    var centerPY = mapHeight / 2;
  
    //相差距离米单位
    var dx = (targetX - centerPX) * resoultion66;
    var dy = (targetY - centerPY) * resoultion66;
  
  
    // var targetMec=[centerMec[0]+dx, centerMec[1]-dy];
  
    var targetLonlat = Mercator2lonLat(centerMec[0] + dx, centerMec[1] - dy);
  
    result.x = targetLonlat[0];
    result.y = targetLonlat[1];
  
    return result;
  }
  
  let initParameters =
    [
      {
        name: 'mapSize1',
        value: {
          width: 4750,
          height: 1450
        }
      },
      {
        name: 'mapCenterPoint1',
        value: {
          lng: 118.767413,
          lat: 33,
          zoom: 8.5
        }
      },
      {
        name: 'f_lonlat2px',
        value: f_lonlat2px
      },
      {
        name: 'f_px2lonlat',
        value: f_px2lonlat
      }
  
  
    ];
  let returnObj = {
    data: initParameters
  }
  return returnObj;